package com.guigu.youxuan.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.youxuan.mapper.GoodsImgMapper;
import com.guigu.youxuan.pojo.GoodsImg;
import com.guigu.youxuan.service.IGoodsImgService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author liweixin
 * @since 2024-05-15
 */
@Service
public class GoodsImgServiceImpl extends ServiceImpl<GoodsImgMapper, GoodsImg> implements IGoodsImgService {

    @Override
    public GoodsImg queryGoodsImgByGId(Long gid) {
        QueryWrapper<GoodsImg> wrapper = new QueryWrapper<>();
        wrapper.eq("goods_id",gid);
        wrapper.eq("type",1);
        GoodsImg one = this.getOne(wrapper);
        return one;
    }

    @Override
    public List<GoodsImg> queryGoodsImgByGId2(int id) {
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("goods_id",id);
        List goodsImgById = this.list(wrapper);
        return goodsImgById;
    }
}
